package com.yuanfengerp.goodsTypeInfo.controller;

import com.yuanfengerp.goodsTypeInfo.model.ProductType;
import com.yuanfengerp.goodsTypeInfo.servicer.IProductTypeService;
import com.yuanfengerp.publicUtil.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class ProductTypeController {
    @Autowired
    private IProductTypeService productTypeService;
    //新增商品类型
    @PostMapping ("/insertProductType")
    public Result<Integer> insertProductType(@RequestBody ProductType productType){
        return productTypeService.insertProductType(productType);
    }
    //根据编号 名称 状态 查询商品类型
    @PostMapping ("/selectProductType")
    public Result<List<ProductType>> selectProductType(@RequestBody Map<String ,Object> condition ){
        return productTypeService.selectProductType(condition);
    }
    //批量启用、禁用商品类型
    @PostMapping ("/updateProductType")
    public Result<Integer> updateProductType(@RequestBody ProductType productType){
        return productTypeService.updateProductType(productType);
    }
    //修改商品类型信息
    @PostMapping ("/updateProductTypeById")
    public Result<Integer> updateProductTypeById(@RequestBody ProductType productType){
        return productTypeService.updateProductTypeById(productType);
    }
}
